package com.ichifinga.airwave.full;
//import com.google.ads.AdView;

import com.ichifinga.airwave.shared.InitialiseHelper;
import com.ichifinga.airwave.shared.PhraseListActivity;
import com.ichifinga.airwave.shared.R;
import com.ichifinga.airwave.shared.entities.Phrase;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.LinearLayout;
import android.widget.TextView;

public class DisplayActivity extends Activity implements  KeyEvent.Callback
{
	//AdView test;
	@Override
    public void onCreate(Bundle savedInstanceState)
    {    	
        super.onCreate(savedInstanceState);
        this.requestWindowFeature(Window.FEATURE_NO_TITLE);
        this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
        setContentView(R.layout.main);
        
        /*if(getPackageName().toLowerCase().contains("lite"))
        {
        	LinearLayout view = (LinearLayout) findViewById(R.id.DisplayLinearLayout);
            
            TextView child = new TextView(getBaseContext());
            
            child.setText("dynamic");
            child.setTextColor(0xffffffff);
            child.setBackgroundColor(0xff000055);
            child.setTextSize(30);
             
            LinearLayout.LayoutParams layoutParams =
            	new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FILL_PARENT,
            		LinearLayout.LayoutParams.WRAP_CONTENT);
           
            child.setLayoutParams(layoutParams);
            
			view.addView(child , 0);
        }*/
        
        InitialiseHelper.InitialisePhrases(this);
	}

    @Override 
	public boolean onKeyUp (int keyCode, KeyEvent event)
	{
		if(keyCode == KeyEvent.KEYCODE_MENU)
		{
			Intent ii = new Intent(this, PhraseListActivity.class);

			startActivityForResult(ii, 0);
			
			return true;
		}
		else if(keyCode == KeyEvent.KEYCODE_BACK)
		{
			finish();
			return true;
		}
		return false;
	}
	
	@Override
	public void onActivityResult(int requestCode , int resultCode, Intent intent)
	{
		if(resultCode != RESULT_CANCELED)
		{	
			Phrase.SetCurrentPhraseId(getBaseContext(), resultCode);
		}
	}
}
